Trouble with Scatter... May be a library conflict

by: dgrawr, 9 years ago


I emailed this to Harrison before i realized i should have posted it (I'm new to the community). The following code (from Harrison's tutorials) hangs on the 'scatter' instruction. Would appreciate any assistance.

My software config is Python 2.7.9, MPICH 3.2, and mpi4py 2.0.0

thanks. dgr


from mpi4py import MPI

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

if rank == 0:
   data = [(x+1)**x for x in range(size)]
   print 'we will be scattering:',data
else:
   data = None
  
data = comm.scatter(size, root=0)
print 'rank',rank,'has data:',data





You must be logged in to post. Please login or register an account.



Define "hangs?" Do you see the "we will be scattering" message? Do you get any errors or literally nothing for an infinite amount of time?

-Harrison 9 years ago

You must be logged in to post. Please login or register an account.


Harrison - thanks for responding... here's are two examples, one with all five Pi's and the second with one Pi. In both examples i had to Ctrl-C out.

pi@aor00:~/Desktop/sct $ mpirun.openmpi -np 5 -machinefile /home/pi/mpi_testing/machinefile python /home/pi/Desktop/sct/basic_test.py
we will be scattering: [1, 2, 9, 64, 625]
Traceback (most recent call last):
  File "/home/pi/Desktop/sct/basic_test.py", line 13, in <module>
    data = comm.scatter(size, root=0)
  File "MPI/Comm.pyx", line 1222, in mpi4py.MPI.Comm.scatter (src/mpi4py.MPI.c:94445)
  File "MPI/msgpickle.pxi", line 745, in mpi4py.MPI.PyMPI_scatter (src/mpi4py.MPI.c:40417)
  File "MPI/msgpickle.pxi", line 132, in mpi4py.MPI._p_Pickle.dumpv (src/mpi4py.MPI.c:33486)
TypeError: 'int' object is not iterable
^Cmpirun.openmpi: killing job...

pi@aor00:~/Desktop/sct $ mpirun.openmpi -np 1 -machinefile /home/pi/mpi_testing/machinefile python /home/pi/Desktop/sct/basic_test.py
we will be scattering: [1]
Traceback (most recent call last):
  File "/home/pi/Desktop/sct/basic_test.py", line 13, in <module>
    data = comm.scatter(size, root=0)
  File "MPI/Comm.pyx", line 1222, in mpi4py.MPI.Comm.scatter (src/mpi4py.MPI.c:94445)
  File "MPI/msgpickle.pxi", line 745, in mpi4py.MPI.PyMPI_scatter (src/mpi4py.MPI.c:40417)
  File "MPI/msgpickle.pxi", line 132, in mpi4py.MPI._p_Pickle.dumpv (src/mpi4py.MPI.c:33486)
TypeError: 'int' object is not iterable
--------------------------------------------------------------------------
mpirun.openmpi noticed that the job aborted, but has no info as to the process
that caused that situation.
-------------

and my exact code....

from mpi4py import MPI

comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()

if rank == 0:
   data = [(x+1)**x for x in range(size)]
   print 'we will be scattering:',data
else:
   data = None
  
data = comm.scatter(size, root=0)
print 'rank',rank,'has data:',data



thanks for the help. dgr

-dgrawr 9 years ago

You must be logged in to post. Please login or register an account.


Correction - only in the 5 np case did i have to Ctrl-C

-dgrawr 9 years ago

You must be logged in to post. Please login or register an account.


One more note... i am using mpi4py version 2.0.0... don't know if there's an incompatibility there from what you used in your tutorials.

-dgrawr 9 years ago

You must be logged in to post. Please login or register an account.


Noting your other posts too. First, I do not expect it would be a compatibility issue with versions. Typically if you type deprecated code, the modules will at least warn you about your outdated attempts. You could try to use an older version to see, but that's probably not it.

That said, I am not sure what else it would be. Did you successfully run the other code?

Did the TypeError: 'int' object is not iterable error come before or after you did the ctrl+c break?


-Harrison 9 years ago

You must be logged in to post. Please login or register an account.


Came before the break... printed the error tracing sequence, then hung.

i ran the calculate pi (cpi) code successfully on all five pi's and on one pi.

here is my mpirun line just to be complete...

mpirun.openmpi -np 1 -machinefile /home/pi/mpi_testing/machinefile python /home/pi/Desktop/sct/basic_test.py

thanks

-dgrawr 9 years ago

You must be logged in to post. Please login or register an account.